package com.example.day02;

//method方法工具类测试
public class TestMethod {
    public static void main(String[] args) {

        //绝对值
        int i=Math.abs(-100);
        System.out.println(i);

        //求幂      pow    double类型
        double pow = Math.pow(2, 3);
        System.out.println(pow);
        double pow1 = Math.pow(3 ,5);
        System.out.println(pow1);

        //求根号
        double sqrt = Math.sqrt(9);
        System.out.println(sqrt);

        //求最大值
        int max = Math.max(10, 20);
        System.out.println(max);

        //求随机数
        //double random()  //{0.0 1.0）之间的小数
        double random = Math.random();
        System.out.println(random);

        //计算任意两个数之间的随机整数
        int n= (int) (Math.random()*100+1);
        System.out.println(n);

        //3-5之间的随机整数
        int m= (int) (Math.random()*3+3);
        System.out.println(m);


        //四舍五入 向下取整
        double floor = Math.floor(-3.6);
        System.out.println(floor);

        //四舍五入向上取整
        long round = Math.round(3.3);
        System.out.println(round);
    }
}
